// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  currentPage: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  currentPage: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
  }
  export interface ResLogin {
    accessToken: string;
    expiresTime: string;
    refreshToken: string;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    username: string;
    gender: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string[];
    status: number;
  }
  export interface ResUserList {
    id: string;
    username: string;
    gender: number;
    user: { detail: { age: number } };
    idCard: string;
    email: string;
    address: string;
    createTime: string;
    status: number;
    avatar: string;
    photo: any[];
    children?: ResUserList[];
  }
  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}

export interface Admin {
  userId?: string;
  username: string;
  password: string;
  department: string;
  realName: string;
  adminFlag: number;
}

export interface Device {
  bizId: string;
  deviceSn: string;
  protocolType: string;
  protocolVersion: string;
  deviceStatus: number;
  lastLoginTime: string;
  lastOfflineTime: string;
  createTime: string;
  updateTime: string;
}

export interface Rule {
  ruleName: string;
  windowType: number;
  maxMessageNum: number;
  protocolType: string;
  checkCmd: string;
  excludeCmd: string;
  continuousPeriod: number;
  addBlacklistEnable: number;
  bannedTime: number;
  informType: number;
  state: number;
  excludeCmdList: string[];
}

export interface BOM extends ReqPage {
  bomId: string;
  serialNumber: string;
  materialNumber: string;
  productName: number;
  name: string;
  referenceNum: number;
  formalMaterial: number;
  status: number;
  createTime: string;
}

export interface ImportInfo {
  power: number;
  standard: number;
  color: number;
  chargerGun: number;
  label: [];
}

export interface BOMItem extends BOM {
  serialNumber: string;
  positionNumber: string;
  usedNumber: string;
  unit: string;
  primarySubstituteRelationship: string;
  relationshipId: string;
  requester: string;
  requestingDepartment: string;
  requestDate: string;
  skipLayers: number;
  materialDescription: string;
}

export interface BOMDetail extends BOM, ImportInfo {
  versionCode: string;
  createBy: string;
  remark: string;
  referenceBomId: string;
  operateType: number;
  referenceBomName: string;
  referenceBomRelateCount: number;
  platformReviewer: string;
  platformReviewTime: string;
  platformReviewStatus: string;
  platformReviewOpinion: string;
  bomItems: BOMItem[];
}
